package bean;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * 圆柱
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class Cylinder extends Circle {
    private double length;

    public Cylinder() {
        this.length = 1;
    }

    public Cylinder(double length) {
        this.length = length;
    }

    public Cylinder(double radius, double length) {
        super(radius);
        this.length = length;
    }

    public double findVolume() {
        return super.findArea() * length;
    }

    @Override
    public double findArea() {
        return super.findArea() * 2 +
                Math.PI * 2 * getRadius() * this.length;
    }
}
